package scala.test_class.test_case_class

/**
 * @author 黄海峰 2021/4/19 11:05
 * */
object DeanTest {
  def main(args: Array[String]): Unit = {
    val frankenstein = Book("124-5454123121")
    println(frankenstein)

    val message = Message("1652644545@qq.com", "huanghaifeng15@jd.com", "Ça va ?")
    println(message.sender)
    println(message.recipient)
    println(message.body)

    // message.sender = "ssss.@qq.com"

    var message2 = message
    var message3 = Message("", "", "")
    // message3.sender = "ssss.@qq.com"


    val message22 = Message("1652644545@qq.com", "huanghaifeng15@jd.com", "Ça va ?")
    println(message == message22)

    val message33 = Message("31652644545@qq.com", "3huanghaifeng15@jd.com", "3Ça va ?")
    println(message == message33)

    val message44 = message22.copy(sender = "zzz@qq.com")
    println(message22 == message44)


    val message55 = message22.copy()
    println(message22 == message55)

  }
}

/**
 * A minimal case class requires the keywords case class,
 * an identifier, and a parameter list (which may be <empty>):
 *
 * You can’t reassign case class, because it is a val (<immutable>)
 * It is possible to use vars in case classes but this is discouraged.
 */